home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT8 / PG0806.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  4.8 KB  |  108 lines

  1. ;***********************************************************************
  2. ;
  3. ; Program PG0806 ( Chapter 8 )
  4. ;
  5. ; Creating a new image for a character (The letter "E" is changed")
  6. ;
  7. ; Author: A.I.Sopin,   Voronezh, 1992
  8. ;
  9. ;***********************************************************************
  10. .MODEL  SMALL
  11. EXTRN   VIDTYP : FAR
  12.  
  13. BEL     EQU     7
  14. CR      EQU     13
  15. LF      EQU     10
  16. .STACK
  17. ;----------------------------------------------------------
  18. .DATA 
  19. TEXT0   DB      ' Demonstration of a special character creating.'
  20.     DB        ' (Esc -Exit)', CR, LF,  "$"
  21. TEXT1   DB      ' This is the text consisting of letters "EEEEEEEEEEEEEEEE".'
  22.     DB      '  Press any key...',BEL, '$'
  23. TEXT2   DB      CR, LF
  24.     DB      ' EGA or VGA  card not installed !  Press any key...', '$'
  25. VMODE   DB      0
  26. NEWFONT DB      0,0,0FEh,0CCh,8Ch,2Ch,3Ch,2Ch,0Ch,8Ch,0CCh,0FEh,0,0
  27.  
  28. ; row N     Character matrix  8x14      Hex representation
  29. ;
  30. ;   0     .  .  .  .  .  .  .  .     00h 
  31. ;   1     .  .  .  .  .  .  .  .     00h
  32. ;   2     ▄  ▄  ▄  ▄  ▄  ▄  ▄  .     0FEh     
  33. ;   3     ▄  ▄  .  .  ▄  ▄  .  .     0CCh
  34. ;   4     ▄  .  .  .  ▄  ▄  .  .     8Ch
  35. ;   5     .  .  ▄  .  ▄  ▄  .  .     2Ch
  36. ;   6     .  .  ▄  ▄  ▄  ▄  .  .     3Ch
  37. ;   7     .  .  ▄  .  ▄  ▄  .  .     2Ch
  38. ;   8     .  .  .  .  ▄  ▄  .  .     0Ch
  39. ;   9     ▄  .  .  .  ▄  ▄  .  .     8Ch
  40. ;  10     ▄  ▄  .  .  ▄  ▄  .  .     0CCh
  41. ;  11     ▄  ▄  ▄  ▄  ▄  ▄  ▄  .     0FEh
  42. ;  12     .  .  .  .  .  .  .  .     00h
  43. ;  13     .  .  .  .  .  .  .  .     00h
  44.  
  45. ;----------------------------------------------------------
  46. .CODE
  47. .Startup
  48.     mov     ah,0Fh                  ; function 0Fh - get video mode
  49.     int     10h                     ; BIOS video service call
  50.     mov     VMODE,al                ; save original video mode
  51. ;------
  52. Begin:  mov     ah,0                    ; function 00h - set video mode
  53.     mov     al,3                    ; 80x25  Color
  54.     int     10h                     ; BIOS video service call
  55.     xor     bh,bh                   ; video page 0
  56.     mov     ah,2                    ; function 02h - set cursor
  57.     mov     dx,0100h                ; initial position - 1,0
  58.     int     10h                     ; BIOS video service call
  59. ;------
  60. ; Check whether EGA or VGA installed
  61.     Call    VIDTYP                  ; determine cideo adapter type
  62.     cmp     al,3                    ; EGA  or  VGA ?
  63.     jnl     OK                      ; OK
  64.     lea     dx,TEXT2                ; address of string for output
  65.     mov     ah,9                    ; function 09h - output string
  66.     int     21h                     ; DOS service call
  67.     mov     ah,0                    ; function 00h - get key
  68.     int     16h                     ; BIOS keyboard service call
  69.     jmp     Exit                    ; to finishing program
  70. ;------
  71. OK:     lea     dx,TEXT0                ; address of string for output
  72.     mov     ah,9                    ; function 09h - output string
  73.     int     21h                     ; DOS service call
  74.     lea     dx,TEXT1                ; address of string for output
  75.     mov     ah,9                    ; function 09h - output string
  76.     int     21h                     ; DOS service call
  77.     mov     ah,0                    ; function 00h - get key
  78.     int     16h                     ; BIOS keyboard service call
  79.     cmp     al,1Bh                  ; Esc ?
  80.     je      Exit                    ; If so, finish the program
  81. ;-------------------------------------------------------------------
  82. ; Output new image for the letter "E"
  83.     xor     bl,bl                   ; Block Number=0
  84.     mov     bh,14                   ; size of character cell
  85.     mov     cx,1                    ; number of character changed = 1
  86.     mov     dx,45h                  ; offset for character "E"
  87.     mov     ax,ds                   ; address of DATA segment
  88.     mov     es,ax                   ; ES points to DATA segment
  89.     mov     ax,1100h                ; Subfunction 11
  90.     lea     bp,NEWFONT              ; ES:BP - Address of user font table
  91.     int     10h                     ; BIOS video service call
  92.     mov     ah,0                    ; function 00h - get key
  93.     int     16h                     ; BIOS keyboard service call
  94.     cmp     al,1Bh                  ; Esc ?
  95.     je      Exit                    ; If so, finish the program
  96.     mov     al,VMODE                ; AL - original video mode
  97.     mov     ah,0                    ; function 00h - set video mode
  98.     int     10h                     ; BIOS video service call
  99.     jmp     Begin                   ; continue working
  100. ;-------------------------------------------------------------------
  101. ; Finish the program and return to MS-DOS
  102. Exit:   mov     al,VMODE                ; AL - original video mode
  103.     xor     ah,ah                   ; function 00h - set video mode
  104.     int     10h                     ; BIOS video service call
  105.     mov     ax,4C00h                ; Return Code =0
  106.     int     21h                     ; DOS service call
  107.     END
  108.